package com.jjb.www.ui.activity;

import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.hjq.shape.view.ShapeImageView;
import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppActivity;
import com.jjb.www.http.api.UserInfoApi;
import com.jjb.www.http.glide.GlideApp;
import com.jjb.www.http.model.HttpData;
import com.jjb.www.other.AppConfig;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2019/04/20
 *    desc   : 实名认证
 */
public class RealNameActivity extends AppActivity {
    private ShapeTextView mTvName;
    private ShapeTextView mTvIdcard;
    private ShapeImageView mImgIdcad;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_real_name;
    }

    @Override
    protected void initView() {
        mTvName = findViewById(R.id.tv_name);
        mTvIdcard = findViewById(R.id.tv_idcard);
        mImgIdcad = findViewById(R.id.img_idcad);
    }

    @Override
    protected void initData() {
        getUserInfo();
    }

    private void getUserInfo() {
        EasyHttp.post(this)
                .api(new UserInfoApi()
                        .setUser_id(AppConfig.getInstance().getUserBean().getUser().getId()+""))
                .request(new HttpCallback<HttpData<UserInfoApi.Bean>>(this) {

                    @Override
                    public void onSucceed(HttpData<UserInfoApi.Bean> data) {
                        GlideApp.with(getActivity())
                                .load(data.getData().getUser().getId_card_img_url())
                                .into(mImgIdcad);
                        mTvName.setText(data.getData().getUser().getReal_name());
                        mTvIdcard.setText(data.getData().getUser().getId_card());
                    }
                });
    }
}